Level Editor
The level editor is a tool that users can use to build their own SML levels. It allows people to select tiles, sprites, and utility objects, place them in a level, and modify properties about them. The Basics The level editor is composed of two parts: the original game window, and a Windows Forms window that is used to select and modify objects to be placed in the level. The game window, when the editor is launched, becomes inert - that is, no objects update, but all are drawn. The player can use the arrow keys to navigate around the level, and the mouse to place, select, and modify objects. The object selection window is wider than it is tall. It will be divided into four parts: a toolbar along the top that switches between cursor, blocks, etc. The second part is a tree view along the left side that displays a list of all the resources in all loaded assemblies. The third part is a group of buttons representing objects. The fourth part is a PropertyGrid control that lists the properties for the currently selected object, either in the object window or game window. The Object Group Toolbar The toolbar lists the object groups. Each button will be a single image, cropped out of an internal PNG image, and stored in an Image instance. The buttons are subject to change and as follows: *Cursor: Allows the user to select objects in the game window. The category and object list panes will be empty, and the PropertyGrid will either be empty or show the properties of the selected object. *Blocks *Background Objects *Sprites *Level Settings: Includes section list, music settings, player start positions, level bounds modifier, and level background switcher. The Object Category TreeView The first pane is a tree view listing all the categories and subcategories for the specific object set as chosen by the toolbar. At the top level of the view is a list of all loaded assemblies. The list of categories and subcategories will provided by the assembly, with the static method ObjectCategory CustomSpriteAssemblyData.GetCategoryList(), which returns an object category that can be used in the tree view and may contain subcategories. Then, as defined below, the game can call CustomSpriteAssemblyData.GetEditorButtonLayout(ObjectCategory) with a subcategory name to get the layout of the buttons for the second pane. The Object Selection Buttons The second pane lists the set of objects grouped in this category. A series of buttons that are constructed on the window when the category is selected. SMLEngine.Sprites will contain a structure, EditorButton , that will be used to construct the buttons on the form. Each custom sprite assembly would contain a static class, CustomSpriteAssemblyData, with a method, List GetEditorButtonLayout(ObjectCategory category). This list returned by this method will be used by the editor window to place the buttons. These buttons will be placed on a Panel control or similar, and will be able to scroll if there are too many buttons to fit. In the Game Window The game window will be used to place, select, move, and remove objects. By default, the level will be suspended, but can be tested fully functionally, even as the user edits the level, by pressing a key to start the level. A tile grid can optionally be overlayed on the game window to aid people in placing objects. The user can navigate around the level by pressing the arrow keys.